package com.wholesale.beans;

import org.json.JSONException;
import org.json.JSONObject;

public class ShippingArea {

	private String configure ;
	private int shippingAreaId ;
	private String shippingAreaName ;
	private int shippingId ;
	private JSONObject jsonObject;
	public String getConfigure() {
		return configure;
	}
	public void setConfigure(String configure) {
		this.configure = configure;
	}
	public int getShippingAreaId() {
		return shippingAreaId;
	}
	public void setShippingAreaId(int shippingAreaId) {
		this.shippingAreaId = shippingAreaId;
	}
	public String getShippingAreaName() {
		return shippingAreaName;
	}
	public void setShippingAreaName(String shippingAreaName) {
		this.shippingAreaName = shippingAreaName;
	}
	public int getShippingId() {
		return shippingId;
	}
	public void setShippingId(int shippingId) {
		this.shippingId = shippingId;
	}
	
	public String toJsonString(){
		
		return toJSONObject().toString();
	}
	
	public JSONObject toJSONObject(){
		JSONObject loginObject = new JSONObject();
		try {
			loginObject.put("configure", configure);
			loginObject.put("shippingAreaId", shippingAreaId);
			loginObject.put("shippingAreaName", shippingAreaName);
			loginObject.put("shippingId", shippingId);
		} catch (Exception e) {
		}
		return loginObject;
	}
	
	public void jsonAnalytic(String jsonString){
		
		try {
			jsonObject = new JSONObject(jsonString);
			jsonAnalytic(jsonObject);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	public void jsonAnalytic(JSONObject jsonObject){
		this.jsonObject = jsonObject;
		
			try {
				configure = jsonObject.getString("configure");
			} catch (JSONException e) {
				e.printStackTrace();
			}
			try {
				shippingAreaId = jsonObject.getInt("shippingAreaId");
			} catch (JSONException e) {
				e.printStackTrace();
			}
			try {
				shippingAreaName = jsonObject.getString("shippingAreaName");
			} catch (JSONException e) {
				e.printStackTrace();
			}
			try {
				shippingId = jsonObject.getInt("shippingId");
			} catch (JSONException e) {
				e.printStackTrace();
			}
		
	}
}
